Filter hook 'theme_{$post_type}_templates'
in WP Core File wp-includes/class-wp-theme.php at line 1432
Description
Filters list of page templates for a theme. The dynamic portion of the hook name, `$post_type`, refers to the post type. Possible hook names include: - `theme_post_templates` - `theme_page_templates` - `theme_attachment_templates`
Occurrences
Filename |
Line Number |
wp-includes/class-wp-theme.php |
1432 |
Parameters
Type |
Name |
Description |
string[] |
$post_templates |
Array of template header names keyed by the template file name. |
WP_Theme |
$theme |
The theme object. |
WP_Post|null |
$post |
The post being edited, provided for context, or null. |
string |
$post_type |
Post type to get the templates for. |
PHP Doc
/**
* Filters list of page templates for a theme.
*
* The dynamic portion of the hook name, `$post_type`, refers to the post type.
*
* Possible hook names include:
*
* - `theme_post_templates`
* - `theme_page_templates`
* - `theme_attachment_templates`
*
* @since 3.9.0
* @since 4.4.0 Converted to allow complete control over the `$page_templates` array.
* @since 4.7.0 Added the `$post_type` parameter.
*
* @param string[] $post_templates Array of template header names keyed by the template file name.
* @param WP_Theme $theme The theme object.
* @param WP_Post|null $post The post being edited, provided for context, or null.
* @param string $post_type Post type to get the templates for.
*/